package com.ymttest.database.sqlwapper;

import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;

public class OCRWrapper {
	
	SqlManager manager;

    public OCRWrapper() {
        manager = new SqlManager("ocrservice");
    }
    
    @SuppressWarnings("unchecked")
	public List<Map> selectTopicWeixinByBizId(String bizId) {
    	Map m=new HashMap<>();
    	m.put("bizId", bizId);
    	List<Map> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.OCRMapper.selectTopicWeixinByBizId",
                        m);
        manager.commit();
        return result;
    }
    @SuppressWarnings("unchecked")
	public List<Map> selectTopicWeixinByUrl(String url) {
    	Map m=new HashMap<>();
    	m.put("url", url);
    	List<Map> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.OCRMapper.selectTopicWeixinByUrl",
                        m);
        manager.commit();
        return result;
    }
    /**
     * @param tn 1表示查ymt_message_1
     * @return
     */
    @SuppressWarnings("unchecked")
	public List<Map> selectTopicWeixinJobByTablename(int tn) {
    	Map m=new HashMap<>();
    	m.put("tn","ymt_message_"+tn);
    	List<Map> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.OCRMapper.selectTopicWeixinJobByTablename",
                        m);
        manager.commit();
        return result;
    }
    
    public static void main(String[] args) throws ParseException {
    	OCRWrapper test = new OCRWrapper();
    	Logger.debug("info:"+test.selectTopicWeixinByBizId("2d59d9eb-5721-46e0-92ca-8865e8225111"));
    	Logger.debug("info:"+test.selectTopicWeixinJobByTablename(1));
    }
}
